<ul id="Transactions">
  <%- @week.to_a.reverse.each do |day| -%>
    <%- if current_user.activity_during?(day) -%>
      <li class="date"><%= day.strftime('%A %B %e') %></li>
      <% total = current_user.total_on(day) -%>
      <li>
        <ul>
          <% for item in current_user.items.on(day) -%>
            <li>
              <dl>
                <dt><%= color_money item.value %></dt>
                <dd><%= link_to_remote_redbox h(item.calendar_description), :url=>redbox_edit_item_path(item) %> <span class="tags"><%=h item.tag_names %></dd>
              </dl>
            </li>
          <% end -%>

          <% for job in current_user.jobs -%>
            <% if job.tasks.on(day).size > 0 -%>
              <li>
                <dl>
                  <dt><%= color_money (((job.rate * (job.tasks.minutes_on(day) / 60.0)).round)) %></dt>
                  <dd><%= link_to h(job.name), job_path(job) %></dd>
                </dl>
              </li>
            <% end -%>
          <% end -%>
        </ul>
      </li>
    <%- end -%>
  <%- end -%>
</ul>


<div id="Input">
  <div id="NewTransaction">
    <% form_for(:item, :url => items_path) do |f| %>
      <p>Date<br/><%= f.date_select :date, :order=>[:month, :day] %></p>
      <p>Amount<br/><%= f.text_field :value, :class=>:money %></p>
      <p>Description<br/><%= f.text_field :description, :class=>:description %></p>
      <p>Tags<br/><%= f.text_field :tag_list, :class=>:description %></p>
      <p><%= submit_tag 'Add Transaction' %></p>
    <% end %>
  </div>

  <% if current_user.jobs.size > 0 -%>
    <div id="NewWork">
      <% form_for(:task, :url => tasks_path) do |f| %>
        <p>Date<br/><%= f.date_select :date, :order=>[:month, :day] %></p>
        <p>Job<br/><%= f.collection_select :job_id, current_user.jobs, :id, :name %></p>
        <p>Time<br/><%= f.text_field :hours, :class=>'time' %> : <%= f.text_field :min, :class=>'time'%></p>
        <p>Description<br/><%= f.text_field :description, :class=>'description'%></p>
        <p><%= submit_tag 'Add Hourly Work' %></p>
      <% end %>
    </div>
  <% end -%>

  
  <%- unless @period.nil? -%>
  	<div id="InOut"></div>
  	<script type="text/javascript">
  	  var expenses = new FusionCharts("/flash/StackedColumn3D.swf", "InOut", "400", "300", "0", "0");
  	  expenses.setDataURL("<%= in_out_bar_graph_url(:format=>:xml, :year=>@period.first.year, :month=>@period.first.month, :day=>@period.first.day, :period=>(@period.last-@period.first)) %>");
  	  expenses.render("InOut");
  	</script>
  <%- end -%>
</div>

<%- unless @period.nil? -%>
  <div id="TagBubble"></div>
  <script type="text/javascript">
	  var expenses = new FusionCharts("/flash/Bubble.swf", "InOut", "800", "300", "0", "0");
	  expenses.setDataURL("<%= tag_bubble_graph_url(:format=>:xml, :year=>@period.first.year, :month=>@period.first.month, :day=>@period.first.day, :period=>(@period.last-@period.first)) %>");
	  expenses.render("TagBubble");
	</script>
	
	<div id="Activity"></div>
  <script type="text/javascript">
	  var expenses = new FusionCharts("/flash/MSArea.swf", "Activity", "800", "300", "0", "0");
	  expenses.setDataURL("<%= activity_graph_url(:format=>:xml, :year=>@period.first.year, :month=>@period.first.month, :day=>@period.first.day, :period=>(@period.last-@period.first)) %>");
	  expenses.render("Activity");
	</script>
<%- end -%>